package com.block.common.util;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;

import java.util.List;

/**
 * 
 * @date 2022/5/6 11:12
 */
public class LogFilterUtil {

    private static List<String> sensitiveWordList = CollUtil.newArrayList("password", "pwdText", "pwdCode", "pinCode", "newPinCode");

    public static JSONObject filterLogs(String tranData){
        JSONObject logJson=JSONObject.parseObject(tranData);
        for (String content: sensitiveWordList){
            if(logJson.containsKey(content)) {
                logJson.put(content, content+":****************");
            }
        }
        return logJson;
    }

}
